home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 4 / The Arsenal Files 4 (Arsenal Computer).ISO / ham / sattrk31.tgz / sattrack-3.1.tar / SatTrack / src / include / vt100.h < prev    next >
C/C++ Source or Header  |  1995-03-16  |  12KB  |  199 lines

  1. /******************************************************************************/
  2. /*                                                                            */
  3. /*  Title       : vt100.h                                                     */
  4. /*  Author      : Manfred Bester                                              */
  5. /*  Date        : 04May92                                                     */
  6. /*  Last change : 15Mar95                                                     */
  7. /*                                                                            */
  8. /*  Synopsis    : This include file contains the VT100 display macros for     */
  9. /*                the satellite tracking program 'sattrack'.                  */
  10. /*                                                                            */
  11. /*                                                                            */
  12. /*  SatTrack is Copyright (c) 1992, 1993, 1994, 1995 by Manfred Bester.       */
  13. /*  All Rights Reserved.                                                      */
  14. /*                                                                            */
  15. /*  Permission to use, copy, and distribute SatTrack and its documentation    */
  16. /*  in its entirety for educational, research and non-profit purposes,        */
  17. /*  without fee, and without a written agreement is hereby granted, provided  */
  18. /*  that the above copyright notice and the following three paragraphs appear */
  19. /*  in all copies. SatTrack may be modified for personal purposes, but        */
  20. /*  modified versions may NOT be distributed without prior consent of the     */
  21. /*  author.                                                                   */
  22. /*                                                                            */
  23. /*  Permission to incorporate this software into commercial products may be   */
  24. /*  obtained from the author, Dr. Manfred Bester, 1636 M. L. King Jr. Way,    */
  25. /*  Berkeley, CA 94709, USA. Note that distributing SatTrack 'bundled' in     */
  26. /*  with ANY product is considered to be a 'commercial purpose'.              */
  27. /*                                                                            */
  28. /*  IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, */
  29. /*  SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF   */
  30. /*  THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED  */
  31. /*  OF THE POSSIBILITY OF SUCH DAMAGE.                                        */
  32. /*                                                                            */
  33. /*  THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT      */
  34. /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A   */
  35. /*  PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"      */
  36. /*  BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, */
  37. /*  UPDATES, ENHANCEMENTS, OR MODIFICATIONS.                                  */
  38. /*                                                                            */
  39. /******************************************************************************/
  40.  
  41. /******************************************************************************/
  42. /*                                                                            */
  43. /* doBeep: generates a beep as warning                                        */
  44. /*                                                                            */
  45. /******************************************************************************/
  46.  
  47. #ifdef NOBEEP
  48. #define doBeep()
  49. #else
  50. #define doBeep() putchar('\007')
  51. #endif
  52.  
  53. /******************************************************************************/
  54. /*                                                                            */
  55. /* gotoXY: cursor positioning, go to column "x" and row "y"                   */
  56. /*         escape sequence: ESC[n;mH     n, m = row, column                   */
  57. /*                                                                            */
  58. /******************************************************************************/
  59.  
  60. #define gotoXY(x,y) printf("\033[%d;%dH",y,x)
  61.  
  62. /******************************************************************************/
  63. /*                                                                            */
  64. /* upCurs: moves cursor up by n lines                                         */
  65. /*         command: ESC[nA   printf("\033[nA")                                */
  66. /*                                                                            */
  67. /******************************************************************************/
  68.  
  69. #define upCurs(n) printf("\033[%dA",n)
  70.  
  71. /******************************************************************************/
  72. /*                                                                            */
  73. /* downCurs: moves cursor down by n lines                                     */
  74. /*           command: ESC[nB   printf("\033[nB")                              */
  75. /*                                                                            */
  76. /******************************************************************************/
  77.  
  78. #define downCurs(n) printf("\033[%dB",n)
  79.  
  80. /******************************************************************************/
  81. /*                                                                            */
  82. /* advCurs: advances cursor by n blanks in the same line                      */
  83. /*          command: ESC[nC   printf("\033[nC")                               */
  84. /*                                                                            */
  85. /******************************************************************************/
  86.  
  87. #define advCurs(n) printf("\033[%dC",n)
  88.  
  89. /******************************************************************************/
  90. /*                                                                            */
  91. /* backCurs: moves cursor backward by n blanks in the same line               */
  92. /*           command: ESC[nD   printf("\033[nD")                              */
  93. /*                                                                            */
  94. /******************************************************************************/
  95.  
  96. #define backCurs(n) printf("\033[%dD",n)
  97.  
  98. /******************************************************************************/
  99. /*                                                                            */
  100. /* clearCurs: clear the line from cursor position                             */
  101. /*            command for clearing the rest of a line:                        */
  102. /*            ESC[K    printf("\033[K")                                       */
  103. /*                                                                            */
  104. /******************************************************************************/
  105.  
  106. #define clearCurs() printf("\033[K")
  107.  
  108. /******************************************************************************/
  109. /*                                                                            */
  110. /* clearLine: clear the line from cursor position (see also gotoXY())         */
  111. /*            this function is gotoXY() and clearcurs() in one                */
  112. /*                                                                            */
  113. /******************************************************************************/
  114.  
  115. #define clearLine(x,y) printf("\033[%d;%dH\033[K",y,x)
  116.  
  117. /******************************************************************************/
  118. /*                                                                            */
  119. /* clearScreen: clears entire screen from cursor position                     */
  120. /*                                                                            */
  121. /******************************************************************************/
  122.  
  123. #define clearScreen() printf("\033[J")
  124.  
  125. /******************************************************************************/
  126. /*                                                                            */
  127. /* underline: switches terminal (VT100) into underline mode                   */
  128. /*            turn on underline option: ESC[4m                                */
  129. /*                                                                            */
  130. /******************************************************************************/
  131.  
  132. #ifdef REVERSEVIDEO
  133. #define underline() printf("\033[4m")
  134. #else
  135. #define underline()
  136. #endif
  137.  
  138. /******************************************************************************/
  139. /*                                                                            */
  140. /* reverse: switches terminal (VT100) into reverse mode                       */
  141. /*          turn on reverse option: ESC[7m                                    */
  142. /*                                                                            */
  143. /******************************************************************************/
  144.  
  145. #ifdef REVERSEVIDEO
  146. #define reverse() printf("\033[7m")
  147. #else
  148. #define reverse()
  149. #endif
  150.  
  151. /******************************************************************************/
  152. /*                                                                            */
  153. /* reverseBlink: switches terminal (VT100) into reverse blink mode            */
  154. /*               turn on reverse and blink option: ESC[5;7m                   */
  155. /*                                                                            */
  156. /******************************************************************************/
  157.  
  158. #ifdef REVERSEVIDEO
  159. #define reverseBlink() printf("\033[5;7m")
  160. #else
  161. #define reverseBlink()
  162. #endif
  163.  
  164. /******************************************************************************/
  165. /*                                                                            */
  166. /* normal: switches terminal (VT100) into normal mode, i.e. turn off          */
  167. /*         reverse and blink mode                                             */
  168. /*         turn off reverse and blink option: ESC[0m                          */
  169. /*                                                                            */
  170. /******************************************************************************/
  171.  
  172. #ifdef REVERSEVIDEO
  173. #define normal() printf("\033[0m")
  174. #else
  175. #define normal()
  176. #endif
  177.  
  178. /******************************************************************************/
  179. /*                                                                            */
  180. /* nl: prints 'new line' character                                            */
  181. /*                                                                            */
  182. /******************************************************************************/
  183.  
  184. #define nl() putchar('\n')
  185.  
  186. /******************************************************************************/
  187. /*                                                                            */
  188. /* bl: prints 'blank' character                                               */
  189. /*                                                                            */
  190. /******************************************************************************/
  191.  
  192. #define bl() putchar(' ')
  193.  
  194. /******************************************************************************/
  195. /*                                                                            */
  196. /* End of include file vt100.h                                                */
  197. /*                                                                            */
  198. /******************************************************************************/
  199.